/************************************************************************************
 RC Hobby Stream
 Twitter automatic feeder

 First version developed with support of Mapelgate Media

"RC Hobby Stream" is protected by the copyright law
© 2011 Enrico Miglino / Tech Consulting (enrico.miglino@ovi.com)
Distributed under the LGPL 3.0 license.

This file is part of "RC Hobby Stream".

    "RC Hobby Stream" is free software: you can redistribute it
    and/or modify it under the terms of the Lesser GNU General Public License
    as published by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    "RC Hobby Stream" is distributed in the hope that it
    will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    Lesser GNU General Public License for more details.

    You should have received a copy of the Lesser GNU General Public License
    along with "RC Hobby Stream".
    If not, see <http://www.gnu.org/licenses/>.
************************************************************************************/

import QtQuick 1.0
import QtWebKit 1.0

Item {
    id: toolbar // This is the main toolbar definition with all the program buttons.

    // Signal handlers for all the toolbar buttons (childs) to send the events
    // to the parent of the toolbar. The signa button_x_Clicked send to the parent
    // the signal event on the toolbar object, so an action function can be associated.
    signal button1Clicked
    signal button2Clicked
    signal button3Clicked
    signal button4Clicked
    signal button5Clicked
    signal button6Clicked

    // Fixed size for all the square buttons in the toolbar
    property int buttonSize: 31
    // Space between buttons
    property int buttonKern: 25

    // ---------------------------------------------------------- START DEBUG BLOCK
    // Debug info.
    // For debug console messages use debugMessage(msg) instead of console.log(msg)
    // in the source module set baseMsg property with the string that should appear
    // before any debug message on the console.
    // To disable debug, set debugStatus to false. This can be done also only in some
    // code blocks.
    property bool debugStatus: false
    property string baseMsg: "*** Debug ToolBar: "
    function debugMessage(msg) { if (debugStatus == true) console.log(baseMsg + msg); }
    // ---------------------------------------------------------- END DEBUG BLOCK

    focus:true

    // Button object creation (from Button1...Button6)
    // For every button is defined the callback function for the click event signal
    Button1 {
        id: button1

        height: buttonSize; width: buttonSize
        anchors.top: parent.top
        onClicked: { toolbar.button1Clicked(); parent.debugMessage("clicked Button 1") }
        focus:true
    }

    Button2 {
        id: button2

        height: buttonSize; width: buttonSize
        anchors.top: parent.top
        transform: Translate { x: buttonKern }
        onClicked: { toolbar.button2Clicked(); debugMessage("clicked Button 2") }
        focus:true
    }

    Button3 {
        id: button3

        height: buttonSize; width: buttonSize
        anchors.top: parent.top
        transform: Translate { x: buttonKern * 2 }
        onClicked: { toolbar.button3Clicked(); debugMessage("clicked Button 3") }
        focus:true
    }

    Button4 {
        id: button4

        height: buttonSize; width: buttonSize
        anchors.top: parent.top
        transform: Translate { x: buttonKern * 3 }
        onClicked: { toolbar.button4Clicked(); debugMessage("clicked Button 4") }
        focus:true
    }

    Button5 {
        id: button5

        height: buttonSize; width: buttonSize
        anchors.top: parent.top
        transform: Translate { x: buttonKern * 4 }
        onClicked: { toolbar.button5Clicked(); debugMessage("clicked Button 5") }
        focus:true
    }

    Button6 {
        id: button6

        height: buttonSize; width: buttonSize
        anchors.top: parent.top
        transform: Translate { x: buttonKern * 5 }
        onClicked: { toolbar.button6Clicked(); debugMessage("clicked Button 6") }
        focus:true
    }
}
